<?php
class paymentAction extends BaseAction
{

    public function response()
    {
        //支付跳转返回页
        $class_name = $this->_request('class_name');
        $payment_info = M('payment')->where(array('class_name'=>$class_name))->find();
        if($payment_info)
        {
            require_once SITE_PATH."system/payment/".$payment_info['class_name']."_payment.php";
            $payment_class = $payment_info['class_name']."_payment";
            $payment_object = new $payment_class();
            $_REQUEST = quotes($_REQUEST);
            $payment_code = $payment_object->response($_REQUEST);
            $this->redirect($payment_code['url']);
        }
        else
        {
            showErr("支付接口不存在");
        }
    }

    public function notify()
    {
        //支付跳转返回页
        $class_name = $this->_request('class_name');
        $payment_info = M('payment')->where(array('class_name'=>$class_name))->find();
        if($payment_info)
        {
            require_once SITE_PATH."system/payment/".$payment_info['class_name']."_payment.php";
            $payment_class = $payment_info['class_name']."_payment";
            $payment_object = new $payment_class();
            $payment_code = $payment_object->notify($_REQUEST);
        }
    }
}
?>